package com.haoyeteng.sxbd.modular.business.service.impl;

import com.haoyeteng.sxbd.modular.business.model.MsgContent;
import com.haoyeteng.sxbd.core.util.ToolUtil;
import com.haoyeteng.sxbd.modular.business.dao.MsgContentMapper;
import com.haoyeteng.sxbd.modular.business.service.IMsgContentService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 消息内容表 服务实现类
 * </p>
 *
 * @author haoyeteng123
 * @since 2019-06-26
 */
@Service
public class MsgContentServiceImpl extends ServiceImpl<MsgContentMapper, MsgContent> implements IMsgContentService {

	@Autowired
	private MsgContentMapper msgContentMapper;
	
    /**
             * 批量删除消息	
     */
	@Override
	public Integer bathDelByIds(String msgContentIds) {
		Integer number=0;
		if(ToolUtil.isNotEmpty(msgContentIds)) {
		 String [] ids=msgContentIds.split(",");
	     List<String> list= new ArrayList<>();
	        for(int i=0;i<ids.length;i++) {
	         list.add(ids[i]);
	        }
	        number=msgContentMapper.bathDelByIds(list);
	}
		return number;
	}
    /**
             *标记已读  
     */
	@Override
	public Integer redByIds(String msgContentIds) {
		Integer number=0;
		String[] msgContentIdsArray=msgContentIds.split(",");
		 number=msgContentMapper.redByIds(msgContentIdsArray);
			return number;
		}
	}

